set -e

source ./make_openssl_3.0.7.sh

for i in {1..10000}
do
    $openssl ecparam -name prime256v1 -genkey -noout -out eckey.pem
    $openssl ec -in eckey.pem -text -noout -out keypair.txt
    TrimOpensslText keypair.txt
    private_key=$(GetNthLine keypair.txt 3)
    echo $private_key
    if [[ $private_key =~ ^00 ]]
    then
        echo "!!!!found!!!! iteration times: " $i
        break
    fi
done

cat eckey.pem
$openssl ec -in eckey.pem -outform DER -out eckey.der
FileHexDump eckey.der

$openssl ec -in eckey.pem -pubout -out ecpubkey.pem
cat ecpubkey.pem
$openssl ec -pubin -in ecpubkey.pem -outform DER -out ecpubkey.der
FileHexDump ecpubkey.der
